#ifndef MSG_HANDLER_H
#define MSG_HANDLER_H
#include "msg_receive.h"

typedef enum{
	SIGNAL_STRENGTH_PACKET = 0x01,
	END_POWER_TRANSFER_PACKET = 0x02,
	CONTROL_ERROR_PACKET = 0X03,
	BIT_8_RECEIVED_POWER_PACKET = 0x04,   //BPP ONLY
	CHARGE_STATUS_PACKET = 0x05,
	POWER_CONTROL_HOLD_OFF_PACKET = 0x06,
	CONFIGURATION_PACKET = 0x51,
	INDENTIFICATION_PACKET = 0x71,
	WIRELESS_POWER_ID_PACKET_MOST = 0X54,
	WIRELESS_POWER_ID_PACKET_LEAST = 0X55,
	EXTENDED_INDENTIFICATION_PACKET = 0x81,
	BIT_24_RECEIVED_POWER_PACKET = 0x31,  //EPP ONLY
	GENERAL_REQUEST_PACKET = 0x07,    //EPP ONLY
	SPECIFIC_REQUEST_PACKET = 0x20,   //EPP ONLY
	
	FOD_STATUS_PACKET = 0x22,
	RENEGOTIATE_PACKET = 0x09,
}ASK_MSG_PACKET;

typedef enum{
	UNKNOWN = 0x00,
	CHARGE_COMPLETE = 0x01,
	INTERNAL_FAULT = 0x02,
	OVER_TEMPERATURE = 0x03,
	OVER_VOLTAGE = 0x04,
	OVER_CURRENT = 0x05,
	BATTERY_FAILURE = 0x06,
	NO_RESPONSE = 0x08,
	NEGOTIATION_FAILURE = 0x0A,
	RESTART_POWER_TRANSFER = 0x0B,
}END_POWER_VALUE;

typedef enum{
	SREQ_END_NEG  = 0x00,   // End Negotiation
	SREQ_G_POWER  = 0x01,   // Guaranteed Power
	SREQ_RPP_TYPE = 0x02,  // Received Power Packet Type
	SREQ_FSK_PARA = 0x03,  // FSK Parameters
	SREQ_MAX_POWER= 0x04,  // Maxmum Power
	
	SREQ_NUM_END  = 0x100,  	
}SREQ_T;

typedef enum{
	RP_NORMAL_VALUE = 0,    // power_tx_response(RESPONSE_ACK);
	RP_LIGHT_LOAD = 1,	    // Light-load calibration value; Response requested
	RP_CONNECT_LOAD = 2,    // Connected-load calibration value; Response requested
	RP_NORMAL = 4,          // Normal value; no Response expected
}RP_MODE;

typedef struct identification_packet_t{
	uint8_t major_ver;
	uint8_t minor_ver;
	uint8_t ext;
	uint8_t mf_code0;
	uint8_t mf_code1;
	uint8_t device_id0;
	uint8_t device_id1;
	uint8_t device_id2;
	uint8_t device_id3;	
}id_packet_t;


typedef struct configuration_packet_t{
	uint8_t power_class;
	uint8_t max_power_val;
	uint8_t prop;
	uint8_t zero;
	uint8_t count;
	uint8_t wind_size;
	uint8_t wind_offset;	
	uint8_t neg;
	uint8_t polarity;
	uint8_t depth;
}config_packet_t;

extern void ask_msg_handle(msg_body_t *msg);
#endif
